package no.saiboten.tourbuilder.bracket;

import no.saiboten.tourbuilder.user.User;

public class Match {
	private User home;
	private User away;

	@Override
	public String toString() {
		return "Match [home=" + ", pointsHome=" + pointsHome + home + ", away="
				+ away + ", pointsAway=" + pointsAway + ", finished="
				+ finished + "]";
	}

	private int pointsHome;
	private int pointsAway;

	public User getHome() {
		return home;
	}

	public void setHome(User home) {
		this.home = home;
	}

	private boolean finished;

	public User getAway() {
		return away;
	}

	public void setAway(User away) {
		this.away = away;
	}

	public int getPointsHome() {
		return pointsHome;
	}

	public void setPointsHome(int pointsHome) {
		this.pointsHome = pointsHome;
	}

	public int getPointsAway() {
		return pointsAway;
	}

	public void setPointsAway(int pointsAway) {
		this.pointsAway = pointsAway;
	}

	public boolean isFinished() {
		return finished;
	}

	public void setFinished(boolean finished) {
		this.finished = finished;
	}

	public Match() {
		pointsAway = 0;
		pointsHome = 0;
	}

	public User Winner() {
		if (pointsHome > pointsAway) {
			return home;
		} else if (pointsHome < pointsAway) {
			return away;
		} else {
			return null;
		}
	}
}
